package com.lc.handler;

import com.lc.adapter.HttpAdapter;
import com.lc.config.Configuration;
import com.lc.mode.Request;
import com.lc.mode.Response;

/**
 * @author liuc
 * @date 2021/5/7
 * @description 匹配请求
 **/
public class ProtocolHandler {

    private Configuration configuration;

    public ProtocolHandler(Configuration configuration){
        this.configuration = configuration;
    }

    public void handle(Request request, Response response){
        //根据request创建adapter
        HttpAdapter adapter = this.configuration.getAdapter(request.getHostName());
        adapter.adapt(request,response);
    }
}
